/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-03-10     dreamcmi       the first version
 */
#ifndef SRC_ANOTHER_ENCRYPT_H_
#define SRC_ANOTHER_ENCRYPT_H_

#include "stdint.h"
#include "string.h"

#include "mbedtls/aes.h"

#define ANE_ADDRESS (0x40)

#define ANE_AES_ECB (0x01)
#define ANE_AES_CBC (0x02)

#define ANE_ENCRYPT (0x01)
#define ANE_DECRYPT (0x02)

#define ANE_CMD_PRIMER_G    (0x01)
#define ANE_CMD_PRIMER_P    (0x02)
#define ANE_CMD_PUBLIC_A    (0x03)
#define ANE_CMD_PUBLIC_B    (0x04)

#define ANE_CMD_PRIV_ID     (0x11)
#define ANE_CMD_PRIV_ID_ACK (0x12)
#define ANE_CMD_MODE        (0x13)

#define ANE_DATA_REQ    (0x20)
#define ANE_DATA_RSP    (0x21)

#define ANE_FFLUSH      (0xF1)

extern uint8_t g_ende_mode;

void ane_init();
void ane_deinit();
int ane_set_key(uint8_t id);
int ane_set_aes_mode(uint8_t id);
int ane_encrypt(uint8_t *in, uint8_t *out);
int ane_decrypt(uint8_t *in, uint8_t *out);
void dump_key();
void dump_mode();

#endif /* SRC_ANOTHER_ENCRYPT_H_ */
